-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement multi-send transaction command #11738
Conversation
// {4A} / {8A} = {0A} | ||
// {2A} / 0 = panics | ||
// Note, if IsValid was true on Coins, IsValid stays true, | ||
// unless the `divisor` is greater than the smallest coin amount. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am uncertain if we actually want this behavior, but I created these helpers function for avoiding having to do for every coin:
sendCoins := coins
if split && !coins.IsZero() {
sendCoins[0].Amount = coins[0].Amount.Quo(totalAddr)
}
If you find this better, then I can modify it and remove the changes in coins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! What happens when --split
is provided/true, but doesn't have a fully divisible amount? One of the outputs is rounded, correct?
Thanks for all the feedback :) Yes, that's why we need to multiply from |
26e5d22
to
51ed808
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@julienrbrt I completely forgot. We need to add a test to x/bank/client/testutil
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Codecov Report
@@ Coverage Diff @@
## main #11738 +/- ##
==========================================
+ Coverage 65.94% 66.02% +0.07%
==========================================
Files 669 669
Lines 70427 70599 +172
==========================================
+ Hits 46444 46613 +169
- Misses 21312 21316 +4
+ Partials 2671 2670 -1
|
@Mergifyio backport release/v0.46.x |
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Anil Kumar Kammari <anil@vitwit.com> (cherry picked from commit 6a9b824) # Conflicts: # x/bank/client/cli/tx.go
✅ Backports have been created
|
Description
Closes: #7809
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change